package net.miranti.dao;

import java.util.List;
import java.util.Map;

public interface GenericDao {
	<T> T save(T entity);		// PERSIST / UPDATE = MERGE (cobre ambos)
	void delete(Object entity);	// DELETE
	<T> T findById(Class<T> c, Object id);
	<T> List<T> findAll(Class<T> c);

	void updateQuery(String query, Object... params);
	void updateQuery(String query, Map<String, Object> params);
	void namedUpdateQuery(String query, Object... params);
	void namedUpdateQuery(String query, List params);
	void namedUpdateQuery(String query, Map<String, Object> params);

	List query(String query, Integer firstResult, Integer maxResults, Object... params);
	List query(String query, Object... params);
	List query(String query, List params);
	List query(String query, Integer firstResult, Integer maxResults, Map<String, Object> params);
	List query(String query, Map<String, Object> params);

	List namedQuery(String query, Integer firstResult, Integer maxResults, Object... params);
	List namedQuery(String query, Object... params);
	List namedQuery(String query, List params);
	List namedQuery(String query, Integer firstResult, Integer maxResults, Map<String, Object> params);
	List namedQuery(String query, Map<String, Object> params);
	
	List dynaConstraintsQuery(Class clazz, Map constraints);
	List dynaInitialsQuery(Class clazz, Map initials);
	List dynaKeywordsQuery(Class clazz, Map keywords);
	List dynaQuery(Class clazz, Map constraints, Map keywords);
	List dynaQuery(Class clazz, Map constraints, Map initials, Map keywords);
}